/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package redSocial.entities;

import java.io.Serializable;
import java.math.BigDecimal;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author inftel
 */
@Entity
@Table(name = "AMISTAD")
@NamedQueries({
    @NamedQuery(name = "Amistad.findAll", query = "SELECT a FROM Amistad a"),
    @NamedQuery(name = "Amistad.findByIdAmistad", query = "SELECT a FROM Amistad a WHERE a.idAmistad = :idAmistad"),
    @NamedQuery(name = "Amistad.findByEstado", query = "SELECT a FROM Amistad a WHERE a.estado = :estado")})
public class Amistad implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "ID_AMISTAD")
    private BigDecimal idAmistad;
    @Column(name = "ESTADO")
    private String estado;
    @JoinColumn(name = "ID_AMIGO1", referencedColumnName = "ID_USUARIO")
    @ManyToOne
    private Usuario usuario;
    @JoinColumn(name = "ID_AMIGO2", referencedColumnName = "ID_USUARIO")
    @ManyToOne
    private Usuario usuario1;

    public Amistad() {
    }

    public Amistad(BigDecimal idAmistad) {
        this.idAmistad = idAmistad;
    }

    public BigDecimal getIdAmistad() {
        return idAmistad;
    }

    public void setIdAmistad(BigDecimal idAmistad) {
        this.idAmistad = idAmistad;
    }

    public String getEstado() {
        return estado;
    }

    public void setEstado(String estado) {
        this.estado = estado;
    }

    public Usuario getUsuario() {
        return usuario;
    }

    public void setUsuario(Usuario usuario) {
        this.usuario = usuario;
    }

    public Usuario getUsuario1() {
        return usuario1;
    }

    public void setUsuario1(Usuario usuario1) {
        this.usuario1 = usuario1;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idAmistad != null ? idAmistad.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Amistad)) {
            return false;
        }
        Amistad other = (Amistad) object;
        if ((this.idAmistad == null && other.idAmistad != null) || (this.idAmistad != null && !this.idAmistad.equals(other.idAmistad))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "redSocial.entities.Amistad[idAmistad=" + idAmistad + "]";
    }

}
